package servlet;

import model.classes;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;

@WebServlet(value = "/s_selectClassesShow")
public class s_selectClassesShow extends HttpServlet{

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username=(String) req.getSession().getAttribute("using");
        HashMap<Integer,String> hashMap= classes.selectClasses(username);
        if(!hashMap.isEmpty()) {

            req.setAttribute("s_selectClassesShow",hashMap);
            req.setAttribute("username",username);
            req.getRequestDispatcher("/jsp/s_selectClasses.jsp").forward(req,resp);
        }

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
